/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2022-04-22
 * Time: 8:47
 */
public class TestDemo {

    public static void main(String[] args) {
        BinaryTree binaryTree = new BinaryTree();
        binaryTree.create();
        binaryTree.preOrder(binaryTree.create());
        System.out.println();
        binaryTree.midOrder(binaryTree.create());
        System.out.println();
        binaryTree.posOrder(binaryTree.create());
    }


    public static void main5(String[] args) {
        MyCircularQueue myCircularQueue = new MyCircularQueue(5);
        myCircularQueue.add(1);
        myCircularQueue.add(2);
        myCircularQueue.add(3);
        myCircularQueue.add(4);
        myCircularQueue.remove();
        myCircularQueue.remove();
        myCircularQueue.remove();
        System.out.println(myCircularQueue.element());

    }
    public static void main2(String[] args){
        MyListQueue myListQueue = new MyListQueue(); // 队列
        myListQueue.offer(12);
        myListQueue.offer(23);
        myListQueue.offer(34);
        myListQueue.offer(45);

        myListQueue.poll();
        System.out.println(myListQueue.peek().val);
    }


    public static void main3(String[] args) {
        MyArrayStack myArrayStack = new MyArrayStack(); // 栈
        myArrayStack.push(1);
        myArrayStack.push(2);
        myArrayStack.push(3);
        myArrayStack.push(4);
        myArrayStack.pop();
        System.out.println(myArrayStack.peek());
        System.out.println(myArrayStack.empty());
    }


    public static void main4(String[] args) { // 链表
        MyListNode myListNode = new MyListNode();
        myListNode.addLast(1);
        myListNode.addLast(2);
        myListNode.addLast(2);
        myListNode.addLast(4);
        myListNode.addLast(5);
        myListNode.addLast(6);
        System.out.println(myListNode.size());
        myListNode.remove(2);
        System.out.println(myListNode.size());
        myListNode.display();

    }




    public static void main1(String[] args) { // 顺序表
        MyArrayList myArrayList = new MyArrayList();
        myArrayList.create(0,1);
        myArrayList.create(1,2);
        myArrayList.create(2,2);
        myArrayList.create(3,4);
        myArrayList.create(4,5);
        myArrayList.create(5,6);
        myArrayList.display();
        System.out.println(myArrayList.size());
        System.out.println(myArrayList.contains(4));// 判定是否包含某个元素
        System.out.println(myArrayList.search(4));// 查找某个元素对应的位置
        System.out.println(myArrayList.getPos(4));// 获取 pos 位置的元素
        myArrayList.remove(2);// 删除第一次出现的元素
        myArrayList.display();

    }
}
